import { request, config } from 'utils';
import { stringify } from 'qs';
const {
  api: {
    recursivemgt: {
      optimal: { apigetlist, apiadd, apiedit, apidelete },
    },
  },
} = config;

export function getList(params) {
  return request(`${apigetlist}?${stringify(params)}`);
}

export function add(params) {
  return request(apiadd, {
    method: 'POST',
    body: { ...params },
  });
}

export function update(params) {
  return request(apiedit, {
    method: 'POST',
    body: { ...params },
  });
}

export function deleteOptimal(params) {
  return request(apidelete, {
    method: 'POST',
    body: { ...params },
  });
}
